<div id="submenu">
  <a class="button preloader" href="<? echo redirect_str($page); ?>">TABULKA</a>
  <a class="button preloader" href="<? echo redirect_str($page).add_par("tab_type=2"); ?>">TABULKA - DOMA</a>
  <a class="button preloader" href="<? echo redirect_str($page).add_par("tab_type=3"); ?>">TABULKA - VENKU</a>
  <a class="button preloader" href="<? echo redirect_str($page).add_par("tab_type=4"); ?>">TABULKA - PODZIM</a>
  <a class="button preloader" href="<? echo redirect_str($page).add_par("tab_type=5"); ?>">TABULKA - JARO</a>
</div>
<?
$tab_type = $_GET['tab_type'];

if($tab_type == ""){
  $tab_type = 1;
}

$trida = DEFAULT_LEAGUE;

switch($tab_type){
  case 1: $query = getTabulka($trida, "b_celkem", 0, "dif_celkem", 0, "gv_celkem", 0, SEASON, 1, 26);
          $cols = array("v_celkem", "r_celkem", "p_celkem", "gv_celkem", "go_celkem", "b_celkem");
          break;
  case 2: $query = getTabulka($trida,"b_doma",0,"dif_doma",0,"gv_doma",0, SEASON, 1, 26);
          $cols = array("v_doma", "r_doma", "p_doma", "gv_doma", "go_doma", "b_doma");
          break;
  case 3: $query = getTabulka($trida,"b_venku",0,"dif_venku",0,"gv_venku",0, SEASON, 1, 26);
          $cols = array("v_venku", "r_venku", "p_venku", "gv_venku", "go_venku", "b_venku");
          break;
  case 4: $query = getTabulka($trida, "b_celkem", 0, "dif_celkem", 0, "gv_celkem", 0, SEASON, 1, 13);
          $cols = array("v_celkem", "r_celkem", "p_celkem", "gv_celkem", "go_celkem", "b_celkem");
          break;
  case 5: $query = getTabulka($trida, "b_celkem", 0, "dif_celkem", 0, "gv_celkem", 0, SEASON, 14, 26);
          $cols = array("v_celkem", "r_celkem", "p_celkem", "gv_celkem", "go_celkem", "b_celkem");
          break;
}
?>
<div class="center">
<table class="centered medium-table">
  <tr>
    <th>#</th>
    <th>mužstvo</th>
    <th>u</th>
    <th>v</th>
    <th>r</th>
    <th>p</th>
    <th colspan=3>skóre</th>
    <th>body</th>
  </tr>
  <?
  $poz = 1;
  if(mysql_num_rows($query) == 0) echo "<tr><td colspan='10' class='italic'>sezona ještě nezačala</td></tr>";
  while($fetch = MySQL_Fetch_Array($query)){
        $team = $fetch["tym"];
        $is_zdelov = $fetch["is_zdelov"];
        $w = $fetch[$cols[0]];
        $t = $fetch[$cols[1]];
        $l = $fetch[$cols[2]];
        $gv = $fetch[$cols[3]];
        $go = $fetch[$cols[4]];
        $pts = $fetch[$cols[5]];
        $m = $w + $t + $l;
        if($is_zdelov == 1) echo "<tr class='bolded special'>";
        else if($poz % 2 == 1){ echo "<tr>"; }
        else { echo "<tr class='second'>"; }
          echo "<td class='righted'>$poz</td>";
          echo "<td class='lefted'>$team</td>";
          echo "<td>$m</td>";
          echo "<td>$w</td>";
          echo "<td>$t</td>";
          echo "<td>$l</td>";
          echo "<td class='righted'>$gv</td>";
          echo "<td>:</td>";
          echo "<td class='lefted'>$go</td>";
          echo "<td>$pts</td>";
        echo "</tr>";
        $poz++;
  }
  ?>
</table>
</div>